home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: phcoms4.seri.philips.nl!misf1!Pvestjen
- From: Pvestjen@ms.philips.nl (Patrick Vestjens)
- Subject: Re: Help !!!!! on 'strstr"
- Message-ID: <1996Mar13.074034.9064@ms.philips.nl>
- Sender: news@ms.philips.nl
- Organization: Philips Medical Systems, Best
- X-Newsreader: TIN [version 1.2 PL2]
- References: <314703FF.4045@msmail.st.stems.com>
- Date: Wed, 13 Mar 1996 07:40:34 GMT
-
- kim hai (Kim_Hai.Ng@msmail.st.stems.com) wrote:
- : Help !!!!!
-
- : Problem :
- : I need to locate a string within another string, and the process
- : must be case insensitive. As far as I know, strstr() only locates the
- : exact match and is case sensitive.
- : Does anyone konw of any functions that could allow me to locate
- : substrings and is case insensitive ?
-
- : Eg.
- : case 1:
- : string1 = "abc"
- : string2 = "abcdef"
- : case 2:
- : string2 = "Abcdef"
- : case 3:
- : string3 = "aBcdef"
- : case 4:
- : string4 = "abCdef"
- : ...
- : ..
- : .
-
- : Is taking care of all the combinations ( = 8) in string1 the only
- : solution ? I'm working on Unix platform.
-
- One other solution is that you first convert both strings to lower or
- upper case and then do the strstr. Another option is to get the source
- of strstr and put some tolower or toupper functions in it to make it
- case insensitive.
-
- Success, Patrick.
-
-